package codeTop;

public class q83 {
    public ListNode deleteDuplicates(ListNode head) {
        ListNode fast = head;
        ListNode pre = new ListNode(101);
        pre.next = head;
        ListNode slow = pre;
        while (fast != null) {
            if (fast.val == slow.val) {
                slow.next = fast.next;
                fast = slow.next;
            }else {
                fast = fast.next;
                slow = slow.next;
            }
        }
        return pre.next;
    }
}
